package com.mifengs.mall.netWork.api;

import com.mifengs.mall.Constant;
import com.mifengs.mall.entity.HomeData;
import com.mifengs.mall.entity.ResponseBean;
import com.mifengs.mall.entity.ResponseInfo;
import com.mifengs.mall.entity.TokenBean;

import junit.runner.Version;

import java.util.HashMap;
import java.util.Map;

import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.Response;
import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.HEAD;
import retrofit2.http.Header;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.QueryMap;
import rx.Observable;

/**
 * Created by lihaoqi on 2017/11/22.
 */

public interface LoginApi {
    @Headers("InterVersion:V_01_01")
    @FormUrlEncoded
    @POST(Constant.APP_LOGIN)
    Observable<ResponseBean<TokenBean>> login(
            @FieldMap Map<String, Object> map
    );

    @Headers("InterVersion:V_01_01")
    @POST(Constant.FIND_BACK_PW)
    Observable<ResponseBody> findBackPW(@QueryMap HashMap<String, Object> map);

    @Headers("InterVersion:V_01_02")
    @POST(Constant.NEW_SEND_SMS_CODE)
    Observable<ResponseBody> getVerificationCodeRepairPw(@QueryMap HashMap<String, String> map);

    @Headers("InterVersion:V_01_01")
    @FormUrlEncoded
    @POST(Constant.WEIXIN_LOGIN)
    Observable<ResponseBean<TokenBean>> weixinLogin(
            @FieldMap Map<String, Object> map
    );


    @FormUrlEncoded
    @POST(Constant.PHONE_IS_EXIST)
    Observable<ResponseBean<TokenBean>> phoneIsExitsa(
            @FieldMap Map<String, Object> map
    );


    @Headers("InterVersion:V_01_01")
    @FormUrlEncoded
    @POST(Constant.WEIXIN_REGISTER)
    Observable<ResponseBean<TokenBean>> weixinRegByPhone(
            @FieldMap Map<String, Object> map
    );


    @Headers("InterVersion:V_01_02")
    @FormUrlEncoded
    @POST(Constant.SEND_SMSCODE_WEIXIN_REGISTER)
   //@POST("http://192.168.0.127:8082/sendSMSCodeRegister_weixin.do")
    Observable<ResponseBean<TokenBean>> sendSMSCodeRegister(
            @FieldMap Map<String, Object> map
    );
    @Headers("InterVersion:V_01_01")
    @FormUrlEncoded

    @POST(Constant.LOGOUT)
    Observable<ResponseBean<TokenBean>> logout(
            @Header("app_token") String token,
            @FieldMap Map<String, Object> map
    );


}
